// 结算中心的数据

import { reqGetTradeInfoData, reqGetUserAddressListData } from "@/api"



const state={
  userAddressList:[],
  tradeInfo:{}



}
const actions={
  //获取收件人的地址
async  getuserAddressList(){
    const res=await reqGetUserAddressListData()

  },
  //获取结算中心的详细 的数据
  async getTradeInfo({commit}){
    const res=await reqGetTradeInfoData()
    if(res.code==200){
      commit('SAVE_TRADE_INFO_DATA',res.data)
    }
  }
}
const mutations={
  SAVE_TRADE_INFO_DATA(state,tradeInfo){
    state.tradeInfo=tradeInfo
  }
}
const getters={
//待付款的额商品列表
detailArrayList(state) {
  return state.tradeInfo.detailArrayList
},
//原始待付款的商品总金额

originalTotalAmount(state){
  return state.tradeInfo.originalTotalAmount;
},
//实付总金额
totalAmount(state){
  return state.tradeInfo.totalAmount

},
//订单编号
tradeNo(state){
  return state.tradeInfo.tradeNo;
},
//商品数量
totalNum(state){
  return state.tradeInfo.totalNum
},
//当前商品数量的返现金额
activityReduceAmount(state){
  return state.tradeInfo.activityReduceAmount

}


}
export default {
namespaced:true,
state,
actions,
mutations,
getters
}